use probe_rs::probe::{list::Lister, Probe};

use crate::error::{new_err, AppErr, ErrWrap};


pub fn open(id: &str) -> Result<Probe, AppErr> {

    let lister = Lister::new();
    let probes = lister.list_all();
    
    for probe in probes {
        if probe.identifier == id {
            return Ok(probe.open().wrap()?);
        }
    }

    return Err(new_err("没有对应的烧录器"));
}
